package simulator.queue;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class Item 
{
	private final int id;
	private final double creationTime;
	private double nextProcessTime;
	private double endTime;
	private double servedTime;
	private double lastTimeInService;
	private final int numberOfInterruptions = 0;
	private int currentItemQueueId;
	private final List<Event> eventList = Collections.synchronizedList(new LinkedList<Event>());
	private double serviceTime;
	
	public Item(int id, double creationTime, int itemQueueId) 
	{
		this.id = id;
		this.creationTime = creationTime;
		this.nextProcessTime = creationTime;
		this.servedTime = 0;
		this.currentItemQueueId = itemQueueId;
	}

	public double getEndTime() {
		return endTime;
	}

	public void setEndTime(double endTime) {
		this.endTime = endTime;
	}

	public double getServedTime() {
		return servedTime;
	}

	public void setServedTime(double servedTime) {
		this.servedTime = servedTime;
	}

	public int getNumberOfInterruptions() {
		return numberOfInterruptions;
	}

	public double getNextProcessTime() {
		return nextProcessTime;
	}

	public void setNextProcessTime(double nextProcessTime) {
		this.nextProcessTime = nextProcessTime;
	}

	public int getId() {
		return id;
	}

	public double getCreationTime() {
		return creationTime;
	}

	public double getLastTimeInService() {
		return lastTimeInService;
	}

	public void setLastTimeInService(double lastTimeInService) {
		this.lastTimeInService = lastTimeInService;
	}

	public int getCurrentItemQueueId() {
		return currentItemQueueId;
	}

	public void setCurrentItemQueueId(int currentItemQueueId) {
		this.currentItemQueueId = currentItemQueueId;
	}

	public List<Event> getEventList() {
		return Collections.unmodifiableList(eventList);
	}
	
	public boolean addEvent(Event event) {
		return eventList.add(event);
	}

	public double getServiceTime() {
		return serviceTime;
	}

	public void setServiceTime(double serviceTime) {
		this.serviceTime = serviceTime;
	}
}
